use dta/FivaSmithJune2019.dta, clear

keep if year>1908 & year <1930

*********************** CREATE OCCUPATION CATEGORIES ******************************

foreach var in White Farmers Blue Other {
gen `var'=0
}

forvalues i = 11(1)59 {
replace White = 1 if isco1==`i'
}

forvalues i = 60(1)69 {
replace Farmers = 1 if isco1==`i'
}

forvalues i = 70(1)99 {
replace Blue = 1 if isco1==`i'
}

replace Other = 1 if isco1>99.5


*********************** CREATE BLOCS **********************************************
gen bloc="OTH"
replace bloc="LAB" if party=="dna"
replace bloc="LAB" if party=="s"
replace bloc="LAB" if party=="nsa"
replace bloc="LAB" if party=="nkp"
replace bloc="LIB" if party=="a"
replace bloc="LIB" if party=="v"
replace bloc="LIB" if party=="v_a"
replace bloc="CON" if party=="h"
replace bloc="CON" if party=="h_fv"
replace bloc="CON" if party=="fv"

**** take national means 
gen count=1
egen sum_count=sum(count), by(bloc)
collapse White Farmers Blue Other (sum) count, by(year bloc)

	foreach var in White Farmers Blue Other {
	tw (scatter `var' year if bloc=="LAB", connect(l) lpattern(dash) msymbol(D) mcolor(black) mlcolor(black)) ///
	(scatter `var' year if bloc=="LIB", connect(l) lpattern(dash) msymbol(O) mcolor(gray) mlcolor(black)) ///
	(scatter `var' year if bloc=="CON", connect(l) lpattern(dash) msymbol(S) mcolor(white) mlcolor(black)) ///
	, xline(1919.5, lpattern(dash)) xtitle("") ytitle("") title(`var') plotregion(lcolor(white) ilcolor(white)) graphregion(color(white)) scheme(s1mono)  yscale(range(0 1.0)) ylabel(0[0.2]1.0) legend(cols(3) order(1 "LAB" 2 "LIB" 3 "CON"))
	graph save figures/gph/_`var'.gph, replace
	}
cd figures/gph
grc1leg _White.gph _Blue.gph _Farmers.gph _Other.gph, ycommon scheme(s1mono) title(`bloc')
*graph play WhiteCollar
graph export ../FigureA6.pdf, replace
cd ../../
